Creative Tools Integration Documentation
Overview
Integration with Canva, Figma, and Adobe Creative Cloud for design creation, photo editing capabilities, and writing assistant tools.
**Features:**
- Design tool OAuth integration (Canva, Figma, Adobe)
- Photo editing with Sharp (crop, resize, filters, adjustments)
- Writing assistants (Evernote, Grammarly stub)
- Creative asset management UI
- AI-powered design suggestions
Supported Providers
Design Tools
- **Canva**: Design creation and template customization
- **Figma**: Design collaboration and prototyping
- **Adobe CC**: Photoshop and Illustrator editing
Photo Editing
- **Sharp-based processing**: Crop, resize, filters, adjustments
- **Real-time preview**: Client-side editing with API debouncing
Writing Tools
- **Evernote**: Note management (OAuth 1.0a with signature generation)
- **Grammarly**: Writing assistant (enterprise-only stub with LanguageTool alternative)
OAuth Setup
Canva
**Environment Variables:**
CANVA_CLIENT_ID=your_client_id
CANVA_CLIENT_SECRET=your_client_secret
CANVA_REDIRECT_URI=https://your-domain.com/api/integrations/canva/callback**Dashboard Configuration:**
- Visit https://www.canva.com/developers/api
- Create a new OAuth application
- Configure redirect URI
- Enable scopes:
design:read,design:write,design:export,template:read
**Usage:**
import { CanvaClient } from '@/lib/integrations/creative/canva-client';
const client = new CanvaClient(tenantId);
const authUrl = CanvaClient.getAuthorizationUrl(tenantId, state);
const designs = await client.listDesigns({ limit: 10 });Figma
**Environment Variables:**
FIGMA_CLIENT_ID=your_client_id
FIGMA_CLIENT_SECRET=your_client_secret
FIGMA_REDIRECT_URI=https://your-domain.com/api/integrations/figma/callback**Dashboard Configuration:**
- Visit https://www.figma.com/developers/api
- Create a new OAuth app
- Configure redirect URI
- Enable scopes:
file:read,file:write,comments:write,team_library:read
**Usage:**
import { FigmaClient } from '@/lib/integrations/creative/figma-client';
const client = new FigmaClient(tenantId);
const file = await client.getFile(fileKey);Adobe Creative Cloud
**Environment Variables:**
ADOBE_CLIENT_ID=your_client_id
ADOBE_CLIENT_SECRET=your_client_secret
ADOBE_REDIRECT_URI=https://your-domain.com/api/integrations/adobe/callback**Dashboard Configuration:**
- Visit https://developer.adobe.com/creative-cloud/
- Create a new project
- Add APIs: Photoshop, Illustrator
- Configure IMS (Identity Management System)
**Multi-Service Support:**
import { AdobeClient } from '@/lib/integrations/creative/adobe-client';
const client = new AdobeClient(tenantId);
await client.psEditImage(imageId, { adjustments: { brightness: 20 } });
await client.aiCreateGraphic({ width: 1920, height: 1080 });Photo Editing API
Upload Photo
POST /api/media/photos/upload
Content-Type: multipart/form-data
curl -X POST http://localhost:3000/api/media/photos/upload \
-F "image=@photo.jpg" \
-H "Cookie: session=..."**Response:**
{
"success": true,
"data": {
"id": "photo-123",
"filename": "photo.jpg",
"size": 1024000,
"width": 1920,
"height": 1080,
"format": "jpg",
"url": "/api/media/photos/photo-123"
}
}Edit Photo
POST /api/media/photos/:id/edit
Content-Type: application/json
{
"crop": { "x": 10, "y": 10, "width": 500, "height": 500 },
"adjustments": { "brightness": 20, "contrast": 10 },
"filters": [{ "type": "grayscale" }]
}Available Filters
| Filter | Description | Parameters |
|---|---|---|
| grayscale | Black and white conversion | None |
| sepia | Warm vintage tone | None |
| blur | Soft focus | intensity (1-10) |
| sharpen | Edge enhancement | None |
| vintage | Combined sepia + fade | None |
| dramatic | High contrast + saturation | None |
Filter Presets
GET /api/media/filters?action=presets**Response:**
{
"success": true,
"data": {
"filters": [
{
"id": "grayscale",
"name": "Grayscale",
"description": "Basic black and white conversion"
},
{
"id": "vintage",
"name": "Vintage",
"description": "Combined sepia + fade"
}
]
}
}AI Suggestions
Design Suggestions
POST /api/creative/suggestions?type=design
{
"prompt": "modern logo for tech startup",
"context": {
"brandColors": ["#FF0000", "#0000FF"],
"industry": "technology",
"targetAudience": "millennials"
}
}**Response:**
{
"success": true,
"data": {
"suggestions": [
{
"layout": "minimalist with bold typography",
"colors": ["#2C3E50", "#E74C3C", "#ECF0F1"],
"fonts": ["Montserrat", "Open Sans"],
"composition": "center-aligned with negative space"
}
]
}
}Color Suggestions
GET /api/creative/suggestions?type=colors&brandKitId=xxx**Response:**
{
"success": true,
"data": {
"schemes": [
{
"name": "Complementary",
"colors": ["#FF0000", "#00FF00", "#0000FF"],
"accessibility": "AA"
}
]
}
}API Reference
Canva Endpoints
GET /api/integrations/canva?action=connect- Start OAuth flowGET /api/integrations/canva/callback- OAuth callbackDELETE /api/integrations/canva- Disconnect integrationPOST /api/integrations/canva/designs- Create designGET /api/integrations/canva/designs- List designsGET /api/integrations/canva/templates- List templates
Figma Endpoints
GET /api/integrations/figma?action=connect- Start OAuth flowGET /api/integrations/figma/callback- OAuth callbackDELETE /api/integrations/figma- Disconnect integrationGET /api/integrations/figma/files/:key- Get filePOST /api/integrations/figma/files- Create file
Adobe Endpoints
GET /api/integrations/adobe?action=connect&service=photoshop- Start OAuthGET /api/integrations/adobe/callback- OAuth callbackDELETE /api/integrations/adobe?service=photoshop- DisconnectPOST /api/integrations/adobe/photoshop/edit- Edit imagePOST /api/integrations/adobe/illustrator/create- Create graphic
Creative Assets
POST /api/creative/assets- Create asset from providerGET /api/creative/assets- List with filtersPUT /api/creative/assets?id={id}- Update assetDELETE /api/creative/assets?id={id}- Delete assetPOST /api/creative/assets/:id/export/{provider}- Cross-tool export
Cross-Tool Export
Export assets between providers:
POST /api/creative/assets/{id}/export/canva
POST /api/creative/assets/{id}/export/figma
POST /api/creative/assets/{id}/export/adobeAgent Integration
Agents can use creative tools via skill invocations:
// Agent creates Canva design
import { CanvaClient } from '@/lib/integrations/creative/canva-client';
const canvaClient = new CanvaClient(tenantId);
const design = await canvaClient.createDesign({
title: 'Marketing Graphic',
type: 'social-media',
templateId: 'template-123'
});
// Agent edits photo with Sharp
import { PhotoEditorService } from '@/lib/photo-editor';
const photoService = new PhotoEditorService();
const edited = await photoService.editPhoto(imageBuffer, {
filters: [{ type: 'dramatic' }],
adjustments: { brightness: 15, contrast: 10 }
});
// Agent gets AI suggestions
import { CreativeSuggestionsService } from '@/lib/ai/creative-suggestions';
const suggestionService = new CreativeSuggestionsService();
const suggestions = await suggestionService.suggestDesign(
'modern logo',
{ industry: 'tech' }
);Governance Actions
The following governance actions are required for creative tool operations:
CREATIVE_TOOLS_CANVA- Canva design operationsCREATIVE_TOOLS_FIGMA- Figma file operationsCREATIVE_TOOLS_ADOBE- Adobe editing operationsCREATIVE_TOOLS_PHOTO_EDIT- Photo editingCREATIVE_TOOLS_EVERNOTE- Evernote note operations
Troubleshooting
OAuth Flow Fails
- **Symptom**: Redirect to
/integrations?error=canva_access_denied - **Cause**: Redirect URI mismatch or invalid state
- **Fix**: Verify redirect URI matches exactly in provider dashboard
- **Debug**: Check
oauth_statestable for state records
Sharp Installation Fails
- **Symptom**:
Error: libvips not found - **Cause**: Missing system dependency
- **Fix**:
- Ubuntu:
sudo apt-get install libvips - MacOS:
brew install vips - Alternative: Use pure-JS Jimp (slower)
Evernote OAuth 1.0a Fails
- **Symptom**: Invalid signature error
- **Cause**: Incorrect signature generation
- **Fix**: Verify consumer key/secret, check timestamp is current
- **Note**: Evernote uses legacy OAuth 1.0a (complex signature-based auth)
Grammarly Enterprise Only
- **Symptom**:
ENTERPRISE_ONLYerror - **Cause**: Grammarly API requires enterprise contract
- **Alternative**: Use LanguageTool (https://languagetool.org)
- Open source
- Free tier available
- Self-hostable option
- 20+ languages supported
Rate Limiting
All providers have rate limits:
| Provider | Limit | Retry-After |
|---|---|---|
| Canva | 100 req/min | 60s |
| Figma | 120 req/min | 60s |
| Adobe | Varies | 300s |
**Implementation**: Exponential backoff on 429 responses
if (response.status === 429) {
const retryAfter = parseInt(response.headers.get('retry-after') || '60');
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
// Retry request
}Cross-Tool Export Fails
- **Symptom**: Export fails with provider incompatibility
- **Cause**: Provider-specific field mappings
- **Fix**: Manual field mapping required
- **Example**: Figma frames → Canva designs (different object models)
Examples
Create and Export Design
// 1. Create design from template
const client = new CanvaClient(tenantId);
const design = await client.createDesign({
title: 'Summer Sale',
templateId: 'template-456'
});
// 2. Export to PNG
const exportResult = await client.exportDesign(design.id, {
type: 'png',
quality: 'high'
});
// 3. Download from export URL
const response = await fetch(exportResult.exportUrl);
const buffer = await response.arrayBuffer();Apply Photo Filters
import { PhotoEditorService } from '@/lib/photo-editor';
const photoService = new PhotoEditorService();
// Single filter
const grayscale = await photoService.applyGrayscale(imageBuffer);
// Multiple edits
const edited = await photoService.editPhoto(imageBuffer, {
crop: { x: 0, y: 0, width: 1920, height: 1080 },
filters: [
{ type: 'vintage' },
{ type: 'sharpen' }
],
adjustments: {
brightness: 10,
contrast: 15,
saturation: -5
}
});
// Export to WebP
const webp = await photoService.export(edited, 'webp', 85);AI-Powered Design Suggestions
import { CreativeSuggestionsService } from '@/lib/ai/creative-suggestions';
const service = new CreativeSuggestionsService();
// Get design suggestions
const suggestions = await service.suggestDesign(
'modern minimalist logo',
{
brandColors: ['#FF5733', '#33FF57'],
industry: 'technology',
targetAudience: 'startups'
}
);
// Get color schemes
const colors = await service.suggestColors({
primary: '#FF5733'
});
// Get font recommendations
const fonts = await service.suggestFonts('presentation');
// Get layout suggestions
const layout = await service.suggestLayout('landing-page');Testing
Test Coverage Goals
- Creative clients: >80% (Canva, Figma, Adobe)
- Photo editor service: >80%
- Creative UI components: >75%
Run Tests
# Creative integration tests
npm test -- tests/integrations/creative/
# Photo editor tests
npm test -- tests/photo-editor.test.ts
# Creative component tests
npm test -- tests/components/creative.test.tsx
# API integration tests
npm test -- tests/api/creative.test.tsCoverage Report
# Generate coverage report
npm run test:coverage
# View HTML report
open coverage/index.html